import { Refund } from 'refund-model.js';
var refund = new Refund();
Page({

  /**
   * 页面的初始数据
   */
  data: {
   
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.data.sku_id = options.sku_id ? options.sku_id : '';
    this.data.order_id = options.order_id ? options.order_id : '';
    if (!this.data.sku_id || !this.data.order_id){
      return false
    }
    this._loadData();
  },
  // callPhone: function () { //点击拨打电话
  //   wx.makePhoneCall({
  //     phoneNumber: this.data.telphone,
  //     success: function (res) {
  //       console.log("接口调用成功返回的回调")
  //     },
  //     fail: function (res) {
  //       console.log("接口调用失败返回的回调")
  //     },

  //   })
  // },
  _loadData: function () {
    var that = this;
    var args = {
      id: this.data.sku_id,
      order_id: this.data.order_id
    }
    refund.getSkuInfo(args, (res) => {
      var data = res.item;
      that.setData({
        info:data
      })
    });
  },
  des:function(){

  },
  add:function(){

  },
  toDetails:function(e){
    var type = e.currentTarget.dataset.type;  //1换货，2退款退货
    wx.navigateTo({
      url: './apply-details?sku_id=' + this.data.sku_id + '&type=' + type + '&order_id=' + this.data.order_id,
    })
  }

})